package com.android.superobstacleavoider;

public class Vector3 {
	public float X;
	public float Y;
	public float Z;

	public static final Vector3 ZERO = new Vector3(0.0f, 0.0f, 0.0f);

	public Vector3() {
		X = 0.0f;
		Y = 0.0f;
		Z = 0.0f;
	}

	public Vector3(float a_x, float a_y, float a_z) {
		X = a_x;
		Y = a_y;
		Z = a_z;
	}

	public Vector3 set(float a_x, float a_y, float a_z) {
		X = a_x;
		Y = a_y;
		Z = a_z;
		return this;
	}

	public Vector3 set(Vector3 a_vector) {
		return this.set(a_vector.X, a_vector.Y, a_vector.Z);
	}

	public Vector3 add(float a_x, float a_y, float a_z) {
		return this.set(this.X + a_x, this.Y + a_y, this.Z + a_z);
	}

	public Vector3 add(Vector3 a_vector) {
		return this.add(a_vector.X, a_vector.Y, a_vector.Z);
	}

	public Vector3 add(float a_value) {
		return this.set(this.X + a_value, this.Y + a_value, this.Z + a_value);
	}

	public Vector3 sub(Vector3 a_vector) {
		return this.sub(a_vector.X, a_vector.Y, a_vector.Z);
	}

	public Vector3 sub(float a_x, float a_y, float a_z) {
		return this.set(this.X - a_x, this.Y - a_y, this.Z - a_z);
	}

	public Vector3 sub(float a_value) {
		return this.set(this.X - a_value, this.Y - a_value, this.Z - a_value);
	}

	public Vector3 mul(float a_value) {
		return this.set(this.X * a_value, this.Y * a_value, this.Z * a_value);
	}

	public float distSquared(Vector3 a_other) {
		float distX = this.X - a_other.X;
		float distY = this.Y - a_other.Y;
		float distZ = this.Z - a_other.Z;
		return distX * distX + distY * distY + distZ * distZ;

	}
}
